<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<title>祖龙娱乐  - BI系统</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/highcharts.js"></script>
	<script type="text/javascript" src="../../js/drawChart.js"></script>
</h:head>

<h:body>
	<ui:param name="bean" value="#{lostLevelPlayerAction}" />
	
	<span class="pagetitle">玩家分析 —— 等级流失分析</span>
	<p:separator />
	
	<!-- 右侧页面顶部查询部分 -->
	<h:form id="fsearch">
		<p:growl id="growl" showDetail="true" sticky="true" />
        <p:calendar value="#{bean.date}" mode="popup" pattern="yyyy-MM-dd" />
		&#160;&#160;&#160;
		
		<p:selectOneMenu id="platformSel" styleClass="queryPlatform" value="#{bean.queryPlatform}">
	        <f:selectItems value="#{bean.platformItmes}" />
	        <p:ajax update="channelSel serverSel" listener="#{bean.updateChannelItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        
        <p:selectOneMenu id="channelSel" styleClass="queryChannel" value="#{bean.queryChannel}">
	        <f:selectItems value="#{bean.channelItmes}" />
	        <p:ajax update="serverSel platformSel" listener="#{bean.updateServerItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        
        <p:selectOneMenu id="serverSel" styleClass="queryServer" value="#{bean.queryServer}">
	         <f:selectItems value="#{bean.serverItmes}" />
	         <p:ajax update="channelSel platformSel" listener="#{bean.selectedServer}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
		
        <p:commandButton value="查询" action="#{bean.search()}" update=":data" ajax="false" />
	</h:form>
	<br />
	<!-- 数据展示部分，包含表格和图表 -->
	<h:form id="dform">
		<div class="data" id="data">
			 <p:panel id="panel1" header="帐号流失等级分布" style="margin-bottom:10px;">
                 <p:selectOneButton value="#{bean.selectedType}">
                     <f:selectItem itemLabel="次日流失" itemValue="2" />
                     <f:selectItem itemLabel="三日流失" itemValue="3" />
                     <p:ajax update="panel1" listener="#{bean.selectType}" />
                 </p:selectOneButton>
                 <br />

                 <p:dataGrid id="chart1" var="c" value="#{bean.chartData1}" columns="1" layout="grid">
                     <p:panel style="text-align:center">
                         <h:panelGrid columns="1" style="width:100%">
                             <div id="highchartChart1" style="width:100%;height:300px; border:0;">
                                 <script type="text/javascript">
                                     generateChart('#{c.jsonStr}', '#{c.jsonType}', '1');
                                 </script>
                             </div>
                         </h:panelGrid>
                     </p:panel>
                 </p:dataGrid>

                 <p:dataTable id="dlist1" var="l" value="#{bean.dataList1}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="15" style="text-align:center;">
					<f:facet name="{Exporters}">
					 	<h:commandLink styleClass="exporter">
					        <p:graphicImage url="/resources/images/excel.png" height="25px"/>
					        <p:dataExporter type="xls" target="dlist1" fileName="lostUserDatas-#{pageHelper.getNewDateDetailStr()}" />
					    </h:commandLink>
				    </f:facet>
					
					<p:column headerText="等级" styleClass="column" style="width:100px">
						<h:outputLabel value="#{l.level}" />
					</p:column>
                     <p:column headerText="流失帐户数" styleClass="column">
                         <h:outputLabel value="#{l.lossUserNum}" />
                     </p:column>
                     <p:column headerText="流失人数占比" styleClass="column" >
                         <h:outputLabel value="#{pageHelper.double2Percent(l.lossRate)}" />
                     </p:column>
                     <p:column headerText="到达等级帐户数" styleClass="column">
                         <h:outputLabel value="#{l.okUserNum}" />
                     </p:column>
					<p:column headerText="等级流失率" styleClass="column" >
						<h:outputLabel value="#{pageHelper.double2Percent(l.levelLossRate)}" />
					</p:column>
				</p:dataTable>
    		</p:panel>
            <br />

            <p:panel id="panel2" header="分职业次日流失等级分布" style="margin-bottom:10px;">
                <p:dataGrid id="chart2" var="c" value="#{bean.chartData2}" columns="1" layout="grid">
                    <p:panel style="text-align:center">
                        <h:panelGrid columns="1" style="width:100%">
                            <div id="highchartChart2" style="width:100%;height:300px; border:0;">
                                <script type="text/javascript">
                                    generateChart('#{c.jsonStr}', '#{c.jsonType}', '2');
                                </script>
                            </div>
                        </h:panelGrid>
                    </p:panel>
                </p:dataGrid>

                <p:dataTable id="dlist2" var="l" value="#{bean.dataList2}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="15" style="text-align:center;">
                    <f:facet name="{Exporters}">
                        <h:commandLink styleClass="exporter">
                            <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                            <p:dataExporter type="xls" target="dlist2" fileName="lostRoleDatas-#{pageHelper.getNewDateDetailStr()}" />
                        </h:commandLink>
                    </f:facet>

                    <p:column headerText="等级" styleClass="column" style="width:100px">
                        <h:outputLabel value="#{l.level}" />
                    </p:column>
                    <p:column headerText="职业" styleClass="column" style="width:100px">
                        <h:outputLabel value="#{l.schoolStr}" />
                    </p:column>
                    <p:column headerText="流失人数" styleClass="column">
                        <h:outputLabel value="#{l.lossUserNum}" />
                    </p:column>
                    <p:column headerText="流失人数占比" styleClass="column" >
                        <h:outputLabel value="#{pageHelper.double2Percent(l.lossRate)}" />
                    </p:column>
                </p:dataTable>
            </p:panel>


            <p:panel id="panel3" header="分职业次日流失等级分布" style="margin-bottom:10px;" rendered="false">
                <p:dataGrid id="chart3" var="c" value="#{bean.chartData3}" columns="1" layout="grid">
                    <p:panel style="text-align:center">
                        <h:panelGrid columns="1" style="width:100%">
                            <div id="highchartChart3" style="width:100%;height:300px; border:0;">
                                <script type="text/javascript">
                                    generateChart('#{c.jsonStr}', '#{c.jsonType}', '3');
                                </script>
                            </div>
                        </h:panelGrid>
                    </p:panel>
                </p:dataGrid>

                <p:dataTable id="dlist3" var="l" value="#{bean.dataList3}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="15" style="text-align:center;">
                    <f:facet name="{Exporters}">
                        <h:commandLink styleClass="exporter">
                            <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                            <p:dataExporter type="xls" target="dlist3" fileName="lostRoleMainDatas-#{pageHelper.getNewDateDetailStr()}" />
                        </h:commandLink>
                    </f:facet>

                    <p:column headerText="职业" styleClass="column">
                        <h:outputLabel value="#{l.schoolStr}" />
                    </p:column>
                    <p:column headerText="任务顺序" styleClass="column">
                        <h:outputLabel value="#{l.taskSort}" />
                    </p:column>
                    <p:column headerText="任务" styleClass="column">
                        <h:outputLabel value="#{l.taskStr}" />
                    </p:column>
                    <p:column headerText="接取人数" styleClass="column">
                        <h:outputLabel value="#{l.joinNum}" />
                    </p:column>
                    <p:column headerText="完成人数" styleClass="column">
                        <h:outputLabel value="#{l.okNum}" />
                    </p:column>
                    <p:column headerText="完成率" styleClass="column" >
                        <h:outputLabel value="#{pageHelper.double2Percent(l.okPerJoinRate)}" />
                    </p:column>
                </p:dataTable>
            </p:panel>
		</div>
	</h:form>

	<!-- 页脚 -->
	<div class="footer"></div>
</h:body>
</html>